package com.enjoyor.soa.traffic.rest.efoms.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.enjoyor.soa.traffic.api.dto.efoms.WorkordersInfoDto;
import com.enjoyor.soa.traffic.frame.annotation.Auth;
import com.enjoyor.soa.traffic.frame.security.bean.dto.UserDto;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IPingConnectConsumeService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IWorkordersInfoConsumeService;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Auth
@RestController
@RequestMapping({ "/ping" })
@Api("网络数据rest接口")
@CrossOrigin
public class PingConnectController {
	@Autowired
	private IPingConnectConsumeService pingConnectConsumeService;
	
	@GetMapping(value = { "getPingConnectRealList" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("查询网络实时数据")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "pingRealId", value = "网络实时编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devCategoryCode", value = "设备种类编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devName", value = "设备名称", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "creatStartTime", value = "记录开始时间", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "creatEndTime", value = "记录结束时间", paramType = "query", dataType = "String")})
	public ResultPojo getPingConnectRealList(
			@RequestParam(defaultValue = "", value = "pingRealId", required = false) String pingRealId,
			@RequestParam(defaultValue = "", value = "devCategoryCode", required = false) String devCategoryCode,
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "devId", required = false) String devId,
			@RequestParam(defaultValue = "", value = "devName", required = false) String devName,
			@RequestParam(defaultValue = "", value = "creatStartTime", required = false) String creatStartTime,
			@RequestParam(defaultValue = "", value = "creatEndTime", required = false) String creatEndTime,
			HttpServletRequest request) {
		return pingConnectConsumeService.selectPingConnectRealList(pingRealId, devCategoryCode, devTypeCode, devId,
				devName, creatStartTime, creatEndTime);
	}

	@GetMapping(value = { "getPingConnectHisList" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("查询网络历史数据")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "pingHisId", value = "网络历史编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devCategoryCode", value = "设备种类编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devName", value = "设备名称", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "creatStartTime", value = "记录开始时间", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "creatEndTime", value = "记录结束时间", paramType = "query", dataType = "String")})
	public ResultPojo getPingConnectHisList(
			@RequestParam(defaultValue = "", value = "pingHisId", required = false) String pingHisId,
			@RequestParam(defaultValue = "", value = "devCategoryCode", required = false) String devCategoryCode,
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "devId", required = false) String devId,
			@RequestParam(defaultValue = "", value = "devName", required = false) String devName,
			@RequestParam(defaultValue = "", value = "creatStartTime", required = false) String creatStartTime,
			@RequestParam(defaultValue = "", value = "creatEndTime", required = false) String creatEndTime,
			HttpServletRequest request) {
		return pingConnectConsumeService.selectPingConnectRealList(pingHisId, devCategoryCode, devTypeCode, devId,
				devName, creatStartTime, creatEndTime);
	}
}
